<template>
    <div>
        <template v-for="(item, index) in props.options">
            <template v-if="values.includes(item.dictValue)">
                <span
                    v-if="item.listClass == 'default' || item.listClass == ''"
                    :key="item.dictValue"
                    :class="item.cssClass"
                    :index="index"
                >
                    <span class="mr10">{{ item.dictLabel }}</span>
                </span>
                <el-tag
                    v-else
                    :key="item.dictValue"
                    :class="item.cssClass"
                    :disable-transitions="true"
                    :index="index"
                    :type="item.listClass == '' ? 'primary' : item.listClass"
                >
                    <span>{{ item.dictLabel }}</span>
                </el-tag>
            </template>
        </template>
    </div>
</template>

<script setup lang="ts">
const props = defineProps({
    options: Array,
    value: [Number, String, Array],
});
const values = computed(() => {
    if (props.value !== null && typeof props.value !== "undefined") {
        return Array.isArray(props.value) ? props.value : [String(props.value)];
    } else {
        return [];
    }
});
</script>

<style lang="scss" scoped>
.el-tag + .el-tag {
    margin-left: 10px;
}
</style>
